# 4-7 编写程序找出整数列表中最大元素的下标，如果最大元素的个数超过1，那么请打印输出所有的下标
def find_max(list):
    if len(list) == 0:
        return []
    else:
        max_num = list[0]
        max_index = [0]
        for i in range(len(list)):
            if list[i] > max_num:
                max_num = list[i]
                max_index = [i]
            elif list[i] == max_num:
                max_index.append(i)
        return max_index
# 演示案例
list = [1,2,3,55,6,7,55,8]
index = find_max(list)
print(f"列表中最大元素的下标是{index}")
